#! /bin/bash

# Author: Faisal Abu-Nimeh
# Mod Date: 20140306
# Description: After running update2.sh this script must be executed to copy the new GET-2014XXXX files to each mm*

# must be placed in home directory
if [ "$#" -lt 1 ]; then
    echo "Usage: $0 DIRECTORY"
    echo "e.g. $0 GET-20140217"
    exit 1
fi

# rsync -avu $1 mm0.local:/Users/attpc
rm -rf $1.tar*
tar -cf $1.tar $1
bzip2 $1.tar


echo "copying $1.tar.bz2 to all mm servers"

for i in `seq 0 9`;
do
	echo "copying to mm$i server"
	scp $1.tar.bz2 mm$i.local:/Users/attpc
	ssh mm$i.local "tar -jxf $1.tar.bz2"
	echo " "
	echo " "
done  

echo "Done"